package com.cqsw.test;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.util.concurrent.TimeUnit;

/**
 * @Classname Redis
 * @Description TODO
 * @Date 2022/6/13 14:28
 * @Created by Smith.Liu
 */
@Slf4j
@SpringBootTest
public class Redis {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Test
    public void test() {
        stringRedisTemplate.opsForValue().set("name", "李四",5L, TimeUnit.MINUTES);
        String name = stringRedisTemplate.opsForValue().get("name");
        System.out.println("name = " + name);
    }
}
